package com.version1_4.dao.implement;

import com.version1_4.dao.UserDao1_4;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * Created by reeveslee on 16/5/18.
 */
@Repository
public class UserDaoImpl1_4 implements UserDao1_4 {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 注销登陆
     *
     * @param userId
     * @return
     */
    @Override
    public boolean logout(int userId) {
        try {
            String sql = "UPDATE user_info SET baiduId=? WHERE userId=?";
            jdbcTemplate.update(sql, new Object[]{"", userId});
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
